package com.atguigu.admin.service.impl;

import com.atguigu.admin.bean.City;
import com.atguigu.admin.interceptor.LoginInterceptor;
import com.atguigu.admin.mapper.CityMapper;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * ClassName: CityService
 * Package: com.atguigu.admin.service
 * Description:
 *
 * @Author Root
 * @Create 2023/5/3 16:49
 * @Version 1.0
 */
@Service
public class CityServiceImpl {
    @Autowired
    private CityMapper cityMapper;

    Counter counter;
    public CityServiceImpl(MeterRegistry meterRegistry){
     counter = meterRegistry.counter("cityService.saveCity.count");

    }

    public City findById(Long id){
        counter.increment();
        City city = cityMapper.findById(id);
        return city;
    }

}
